<?php
/**
 * Geneone: Content Management Framework
 * Loader
 *
 * http://geneone.neondragon.net/
 *
 * @package Geneone
 * @author Khlo
 * @version 1.0
 * @copyright 2004-2006 Geneone Development Team
 */

if (defined("IN_GENE")) {
	/* Misc constants that we need */
	if (!defined('GENE_PATH')) {
		define ('GENE_PATH', dirname(__FILE__).'/');
	}
	
	/* These aren't always declared in some PHP installations */
	if (!isset($_SERVER['DOCUMENT_ROOT'])) {
		$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], '', str_replace("\\\\", DIRECTORY_SEPARATOR, $_SERVER['PATH_TRANSLATED']));
	}
	
	/* Directory and Path seperator */
	if (!defined('DIRECTORY_SEPARATOR')) { 
		define('DIRECTORY_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
	}
	if (!defined('PATH_SEPARATOR')) {
		define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':');
	}
	
	/* Put Geneone and PEAR in include path */
	if (PEAR_GENE_PATH != PEAR_PATH) {
		$path = PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . PATH_SEPARATOR . PEAR_PATH . PATH_SEPARATOR . PEAR_GENE_PATH;
	} else {
		$path = PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . PATH_SEPARATOR . PEAR_PATH;
	}
	if (function_exists('set_include_path')) {
		set_include_path(get_include_path() . $path);
	} else {
		if (strpos(@ini_get('disable_functions'), 'ini_set') === FALSE ) {
			ini_set('include_path', ini_get('include_path') . $path);
		}
	}
	
	require_once ("Gene.php");
	$gene =& new Gene($geneconfig);
	
	require_once ("Gene/Request.php");
	
	define ("GENE_APPNAME", "Geneone");
	define ("GENE_APPHOMEPAGE", "http://geneone.neondragon.net/");
	define ("GENE_APPGUID", "http://geneone.neondragon.net/geneone/");
	define ("GENE_APPVERSION", "0.6.7");
	define ("GENE_APPAGENT", "Mozilla/5.0 (compatible; U; Geneone/".GENE_APPVERSION."; ".Gene::getSetting("gene_uri").")");
	
	/* Session Cookie Domain */
	if (Gene::getSetting("cookie_path")) {
		ini_set("session.cookie_path", Gene::getSetting("cookie_path"));
	}
	
	if (Gene::getSetting("cookie_domain")) {	
		ini_set("session.cookie_domain", Gene::getSetting("cookie_domain"));
	}
	
	/* Connect to DB */
	$db =& Gene::getDatabase();
}

?>